package com.grass.cropTradingCenter.service.impl;


import com.grass.cropTradingCenter.pojo.dto.CropDto;
import com.grass.cropTradingCenter.pojo.dto.StartCropDto;
import com.grass.cropTradingCenter.pojo.po.StarType;
import com.grass.cropTradingCenter.pojo.vo.user.CropSearchVo;
import com.grass.cropTradingCenter.service.CropService;
import com.grass.cropTradingCenter.service.domain.CropDomainService;
import com.grass.cropTradingCenter.service.domain.UserDomainService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CropServiceImpl implements CropService {

    @Autowired
    CropDomainService cropDomainService;

    @Autowired
    UserDomainService userDomainService;

    @Override
    public List<CropDto> goodsList(CropSearchVo vo) {
        userDomainService.getLoginUser();
        return cropDomainService.getGoodsList(vo);
    }

    @Override
    public CropDto cropDetail(int id) {
        userDomainService.getLoginUser();

        return cropDomainService.cropDetail(id);
    }

    @Override
    public void starCrop(StarType vo) {
        vo.setStarType(1);
        cropDomainService.checkStarStatus(vo);
    }

    @Override
    public List<StartCropDto> getStartList() {
        return cropDomainService.getStarList();
    }
}
